<template>
  <div>
    <br />
    <div class="prism-player" id="J_prismPlayer">
      <link
        rel="stylesheet"
        href="https://g.alicdn.com/de/prismplayer/2.9.3/skins/default/aliplayer-min.css"
      />
      <script
        charset="utf-8"
        type="text/javascript"
        src="https://g.alicdn.com/de/prismplayer/2.9.3/aliplayer-min.js"
      ></script>
    </div>
    <br />
    <br />
    <br />
    <br />
  </div>
</template>

<script>
import player from "~/api/player/player";

export default {
  mounted() {
    new Aliplayer({
      //播放方式二：点播用户推荐
      id: "J_prismPlayer",
      width: "100%",
      autoplay: true,
      vid: this.vid,
      playauth: this.playauth,
      encryptType: 1, //当播放私有加密流时需要设置。
    });
  },
  async asyncData(page) {
    // 根据视频id获取播放凭证
    let result = await player.getPlayAuth(page.params.vid);
    return {
      vid: page.params.vid,
      playauth: result.data,
    };
  },
};
</script>

